import { _path } from '../../mode/allapi'
import { obtainingImages, config, plugin, AMessage } from '../../api/api'
export class help extends plugin {
  constructor() {
    super({
      dsc: 'help',
      rule: [
        {
          reg: /^(#|\/)?征途帮助$/,
          fnc: 'help'
        },
        {
          reg: /^(#|\/)?征途版本$/,
          fnc: 'getVersion'
        }
      ]
    })
  }
  async help(e: AMessage) {
    const HelpData = config.getJson('help')
    const data = {
      HData: HelpData['body'],
      information: HelpData['information']
    }
    const img = await obtainingImages('/resources/html/help/help.html', data)
    if (img) e.reply(img)
    return false
  }

  async getVersion(e: AMessage) {
    const versionData = config.getJson('version')
    const data = {
      botname: versionData['botname'],
      version: versionData['version'],
      HData: versionData['center']
    }
    const img = await obtainingImages(
      '/resources/html/version/version.html',
      data
    )
    if (img) e.reply(img)
    return false
  }
}
